#include "CAppStateIntro.h"

#include "CAppStateManager.h"

CAppStateIntro CAppStateIntro::Instance;

CAppStateIntro::CAppStateIntro() {
    Surf_Logo = NULL;
}

void CAppStateIntro::OnActivate() {
    // Load Simple Logo
    Surf_Logo = CSurface::OnLoad("content/image/title.png");
    Font = CFont::OnLoad("content/fonts/visitor2.ttf", 25);

    StartTime = SDL_GetTicks();
}

void CAppStateIntro::OnDeactivate() {
    SDL_FreeSurface(Surf_Logo);
    Surf_Logo = NULL;
}

void CAppStateIntro::OnLoop() {
    if(StartTime + 3000 < SDL_GetTicks()) {
        CAppStateManager::SetActiveAppState(APPSTATE_MENU);
    }
}

void CAppStateIntro::OnRender(SDL_Surface* Surf_Display) {
    if(Surf_Logo) {
        CSurface::OnDraw(Surf_Display, Surf_Logo, 0, 0);
    }
    CFont::OnDraw(Font, 1, "v1.0_Beta", Surf_Display, 540, 458);
}

CAppStateIntro* CAppStateIntro::GetInstance() {
    return &Instance;
}
